package com.winninghlw.windhplocalutils.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @author water
 * 2025/3/12 9:51
 */
@Configuration
public class RestTemplateTimeOutConfig {
    @Bean
    public RestTemplate restTemplate() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        //连接超时设置 3 秒
        requestFactory.setConnectTimeout(1000 * 60 * 3);
        requestFactory.setReadTimeout(1000 * 60 * 3);
        return new RestTemplate(requestFactory);
    }
}
